package com.xxx.article.client;

import com.xxx.article.domain.Notice;
import com.xxx.article.domain.NoticeFresh;
import com.xxx.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 * @author blijojo
 * @date 2021/6/27 22:10
 */
@FeignClient("tensquare-notice")
public interface NoticeClient {
    /**
     * 新增通知
     *
     * @param notice 通知对象
     * @return result
     */
    @PostMapping("/notice")
    Result save(@RequestBody Notice notice);

    /**
     * 删除待推送消息（新消息）
     *
     * @param noticeFresh 待推送通知
     * @return result
     */
    @DeleteMapping("/notice/fresh")
    Result deleteFresh(@RequestBody NoticeFresh noticeFresh);

    /**
     * 根据条件查询通知
     *
     * @param map 查询条件
     * @return result
     */
    @PostMapping("/notice/search")
    Result findByCondition(@RequestBody Map<String, Object> map);

    /**
     * 根据id删除通知
     *
     * @param noticeId 通知id
     * @return result
     */
    @DeleteMapping("/notice/{noticeId}")
    Result deleteById(@PathVariable("noticeId") String noticeId);

}
